$(function() {
	$("#datagrid_list")
			.datagrid(
					{
						url : '/supplier/list.json',
						rownumbers : true,
						singleSelect : true,
						border : false,
						pagination : true,
						toolbar : '#tb',
						pageSize : 20,
						columns : [ [
								{
									field : "supId",
									title : "",
									hidden : true
								},
								{
									field : "supName",
									title : "供应商",
									formatter : function(value, rowData,
											rowIndex) {
										return "<a href='/supplier/detail?id="
												+ rowData.supId
												+ "&keepThis=true&amp;TB_iframe=true&amp;height=500&amp;width=850' title='修改supplier-"
												+ value + "' class='thickbox'>"
												+ value + "</a>";
									}
								}, {
									field : "supType",
									title : "类型"
								}, {
									field : "supCreatedOn",
									title : "创建时间"
								}, {
									field : "supStatus",
									title : "状态"
								} ] ],
						onLoadSuccess : function(data) {
							tb_Reloadinit();
						}
					});

});

function searchit() {
	var name = $.trim($("#name").val());
	if (name == "") {
		alert("请输入查询条件!");
		return;
	}
	var opts = $('#datagrid_list').datagrid("options");
	opts.url = "/supplier/list.json";
	$('#datagrid_list').datagrid('load', {
		"supName" : name
	});
}